<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <title>反馈</title>
    <link rel="stylesheet" type="text/css" href="../style/api.css" />
    <link rel="stylesheet" type="text/css" href="../style/head.css" />
    <style>
        #closeIt {
            position: absolute;
            top: 35px;
            left: 1rem;
            width: 2rem;
            height: 2rem;
        }

        main {
            padding-top: 75px;
        }

        .selectArea {
            background-color: #fff;
        }

        .selectArea h4 {
            padding: 0.5rem;
        }

        .items {
            padding: 1rem 0.5rem;
            display: flex;
            justify-content: space-around;
            align-items: center;
            flex-wrap: wrap;
        }

        .items span {
            padding: 0.5rem;
            width: 40%;
            border: 1px solid #e9e9e9;
            margin: 0.5rem 0;
            border-radius: 0.5rem;
        }

        .active {
            color: #fff;
            border: none;
            background-color: #3949AB;
        }

        textarea {
            width: 95%;
            display: block;
            margin: 0.5rem auto;
            padding: 1rem;
            resize: none;
            outline: none;
            background-color: #e9e9e9;
        }

        .submit {
            padding: 1rem;
            width: 95%;
            color: #fff;
            text-align: center;
            margin: 1rem auto;
            border-radius: 0.5rem;
            background-color: #3949AB;
        }
    </style>
</head>

<body>
    <header>
        反馈
        <img src="../img/icons/back.png" alt="" onclick="api.closeWin()" id="closeIt">
    </header>
    <main>
        <div class="selectArea">
            <h4>请选择问题类型</h4>
            <div class="items">
                <span data-num="0" class="active">界面不美观</span>
                <span data-num="1">应用启动缓慢</span>
                <span data-num="2">闪退崩溃</span>
                <span data-num="3">其他问题</span>
            </div>
            <h4>备注</h4>
            <textarea name="name" rows="8" cols="80" placeholder="请留下您宝贵的意见"></textarea>
            <div class="submit">提交</div>
        </div>
    </main>
</body>
<script type="text/javascript" src="../js/api.js"></script>
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script type="text/javascript">
    apiready = function() {

    };

    $('.items span').click(function() {
        var index = $(this).index();
        $('.items span:eq(' + index + ')').addClass('active').siblings().removeClass('active');
    })

    $('.submit').click(function() {
        var val = $('textarea').val();
        if($.trim(val).length <= 10 && $.trim(val).length > 0) {
            api.toast({
                msg: '字数太少了，不能少于10个字哦',
                duration: 2000,
                location: 'bottom'
            });
        }
        else if (!val) {
          api.toast({
              msg: '未输入任何内容',
              duration: 2000,
              location: 'bottom'
          });
        }
        else {
          api.showProgress({
              style: 'default',
              animationType: 'fade',
              title: '上传中...',
              text: '稍侯...',
              modal: false
          });
          setTimeout(function() {
              api.hideProgress();
              api.toast({
                  msg: '已上传，感谢您的参与',
                  duration: 2000,
                  location: 'bottom'
              });
              $('textarea').val('');
          },2000)
        }
    })
</script>

</html>
